package com.bw.zhuangao5___day002.Fragment.Movies.One;

import com.bw.mvp.M.BannerModel;
import com.bw.zhuangao5___day002.Fragment.Home.Fragment2.MainCallbck;

import java.util.List;

import io.reactivex.Observer;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
import io.reactivex.schedulers.Schedulers;

/**
 * 类名： MoviesOne_Model
 * 作者： Android工程师杨晨
 * 日期： 2021/9/28 15:01
 * DAO：  ZhuanGao5___Day002
 */
public class MoviesOne_Model extends BannerModel implements MoviesOne_Contion.onemodel {
    @Override
    public void getonemodel(String name, MoviesOne_Callbck moviesOne_callbck) {
        MoviesOne_Okhttp.getMoviesOne_okhttp().retrofit(MoviesOne_api.MovvieSOne).create(MoviesOne_api.class).getjvaben(name)
                .observeOn(AndroidSchedulers.mainThread())
                .subscribeOn(Schedulers.computation())
                .subscribe(new Observer<MoviesOne_JavaBen>() {
                    @Override
                    public void onSubscribe(Disposable d) {

                    }

                    @Override
                    public void onNext(MoviesOne_JavaBen moviesOne_javaBen) {
                        List<MoviesOne_JavaBen.DataBean> dataBeans = moviesOne_javaBen.getData();
                        moviesOne_callbck.sueess(dataBeans);
                    }

                    @Override
                    public void onError(Throwable e) {

                    }

                    @Override
                    public void onComplete() {

                    }
                });

    }
}
